﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.LocalKeywordSpace
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Runtime.CompilerServices;
using UnityEngine.Bindings;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Represents the local keyword space of a Shader or ComputeShader.</para>
  /// </summary>
  [NativeHeader("Runtime/Shaders/Keywords/KeywordSpaceScriptBindings.h")]
  public readonly struct LocalKeywordSpace : IEquatable<LocalKeywordSpace>
  {
    private readonly IntPtr m_KeywordSpace;

    [FreeFunction("keywords::GetKeywords", HasExplicitThis = true)]
    private LocalKeyword[] GetKeywords() => LocalKeywordSpace.GetKeywords_Injected(ref this);

    [FreeFunction("keywords::GetKeywordNames", HasExplicitThis = true)]
    private string[] GetKeywordNames() => LocalKeywordSpace.GetKeywordNames_Injected(ref this);

    [FreeFunction("keywords::GetKeywordCount", HasExplicitThis = true)]
    private uint GetKeywordCount() => LocalKeywordSpace.GetKeywordCount_Injected(ref this);

    [FreeFunction("keywords::GetKeyword", HasExplicitThis = true)]
    private LocalKeyword GetKeyword(string name)
    {
      LocalKeyword ret;
      LocalKeywordSpace.GetKeyword_Injected(ref this, name, out ret);
      return ret;
    }

    /// <summary>
    ///   <para>An array containing all Rendering.LocalKeyword structs in this local keyword space. (Read Only)</para>
    /// </summary>
    public LocalKeyword[] keywords => this.GetKeywords();

    /// <summary>
    ///   <para>An array containing the names of all local shader keywords in this local keyword space. (Read Only)</para>
    /// </summary>
    public string[] keywordNames => this.GetKeywordNames();

    /// <summary>
    ///   <para>The number of local shader keywords in this local keyword space. (Read Only)</para>
    /// </summary>
    public uint keywordCount => this.GetKeywordCount();

    /// <summary>
    ///   <para>Searches for a local shader keyword with a given name in the keyword space.</para>
    /// </summary>
    /// <param name="name">The name of the shader keyword to search for.</param>
    /// <returns>
    ///   <para>Returns a valid Rendering.LocalKeyword if it's present in the keyword space. Otherwise, returns an invalid Rendering.LocalKeyword.</para>
    /// </returns>
    public LocalKeyword FindKeyword(string name) => this.GetKeyword(name);

    public override bool Equals(object o) => o is LocalKeywordSpace rhs && this.Equals(rhs);

    public bool Equals(LocalKeywordSpace rhs) => this.m_KeywordSpace == rhs.m_KeywordSpace;

    public static bool operator ==(LocalKeywordSpace lhs, LocalKeywordSpace rhs) => lhs.Equals(rhs);

    public static bool operator !=(LocalKeywordSpace lhs, LocalKeywordSpace rhs) => !(lhs == rhs);

    public override int GetHashCode() => this.m_KeywordSpace.GetHashCode();

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern LocalKeyword[] GetKeywords_Injected(ref LocalKeywordSpace _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern string[] GetKeywordNames_Injected(ref LocalKeywordSpace _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern uint GetKeywordCount_Injected(ref LocalKeywordSpace _unity_self);

    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void GetKeyword_Injected(
      ref LocalKeywordSpace _unity_self,
      string name,
      out LocalKeyword ret);
  }
}
